<?php
/**
 * Created by PhpStorm.
 * User: aron
 * Date: 2019/7/10
 * Time: 3:01 PM
 */

try {
    $dbh = new PDO('mysql:dbname=testbookstore;host=localhost', 'root', 'root');
} catch (PDOException $e) {
    echo '数据库连接失败：' . $e->getMessage();
    exit;
}


for ($i = 0; $i<300000000; $i++) {
    $query = "INSERT INTO sha_signs (url, sha_sign) VALUES (?, ?)";
    $stmt = $dbh->prepare($query);

    $url = "http://sc.seeyouyima.com/avatar_" . $i . "?x-oss-process=image/resize,m_fill,h_64,w_64";
    $sha_sign = sha1($url);
    $stmt->bindParam(1, $url);
    $stmt->bindParam(2, $sha_sign);
    $stmt->execute();
}

?>